#!/bin/sh
count=0

while true
do  
    ping -c 1 192.168.221.254
    if [ $? != 0 ]
    then
	count=$((count+1))
    fi
    if [ $count -eq 600 ]
    then
	sudo halt
    fi
    echo $count
    sleep 60s
done
